/*
 *
 * Copyright 2021-2025 Software Radio Systems Limited
 *
 * This file is part of srsRAN.
 *
 * srsRAN is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 *
 * srsRAN is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * A copy of the GNU Affero General Public License can be found in
 * the LICENSE file in the top-level directory of this distribution
 * and at http://www.gnu.org/licenses/.
 *
 */

#include "lib/du/du_high/du_manager/ran_resource_management/ue_capability_manager.h"
#include "lib/du/du_high/du_manager/ran_resource_management/ue_capability_summary_formatter.h"
#include "srsran/adt/to_array.h"
#include <fmt/ostream.h>
#include <gtest/gtest.h>

using namespace srsran;
using namespace srs_du;

/// Pairs an encoded ASN.1 message containing a real UE-NR-Capability with the expected UE capability summary.
struct decode_ue_nr_cap_container_params {
  /// COTS UE model.
  std::string model;
  /// Message containing the the UE capabilities.
  std::vector<uint8_t> message;
  /// Expected UE capability summary.
  ue_capability_summary expected_capabilities;
};

namespace srsran {
namespace srs_du {

std::ostream& operator<<(std::ostream& os, const srsran::srs_du::ue_capability_summary& params)
{
  fmt::print(os, "{:n}", params);
  return os;
}

} // namespace srs_du
} // namespace srsran

std::ostream& operator<<(std::ostream& os, const decode_ue_nr_cap_container_params& params)
{
  return os << params.model;
}

class decode_ue_nr_cap_container_tester : public ::testing::TestWithParam<decode_ue_nr_cap_container_params>
{};

TEST_P(decode_ue_nr_cap_container_tester, decode_and_compare_with_expected)
{
  // Select parameters.
  const decode_ue_nr_cap_container_params& param = GetParam();

  // Create ASN.1 Message.
  expected<byte_buffer> message = byte_buffer::create(param.message.begin(), param.message.end());
  ASSERT_TRUE(message);

  // Extract reference to the expected capabilities.
  const ue_capability_summary& expected_caps = param.expected_capabilities;

  // Decode parameters.
  expected<ue_capability_summary, std::string> ret_capabilities = decode_ue_nr_cap_container(message.value());
  ASSERT_TRUE(ret_capabilities.has_value())
      << fmt::format("Failed to decode UE capabilities: {}", ret_capabilities.error());

  // Validate parameters.
  const ue_capability_summary& caps = *ret_capabilities;
  ASSERT_EQ(caps, expected_caps);
}

static constexpr ue_capability_summary::supported_band supported_band_no_ul_mimo = {
    .pusch_qam256_supported         = true,
    .pusch_tx_coherence             = tx_scheme_codebook_subset::non_coherent,
    .pusch_max_rank                 = 1,
    .nof_srs_tx_ports               = 1,
    .max_dl_harq_process_num        = 16,
    .max_ul_harq_process_num        = 16,
    .ul_pre_compensation_supported  = false,
    .ul_ta_reporting_supported      = false,
    .ue_specific_k_offset_supported = false};

#ifdef SRSRAN_HAS_ENTERPRISE
static constexpr ue_capability_summary::supported_band supported_band_2x2_non_coherent = {
    .pusch_qam256_supported         = true,
    .pusch_tx_coherence             = tx_scheme_codebook_subset::non_coherent,
    .pusch_max_rank                 = 2,
    .nof_srs_tx_ports               = 2,
    .max_dl_harq_process_num        = 16,
    .max_ul_harq_process_num        = 16,
    .ul_pre_compensation_supported  = false,
    .ul_ta_reporting_supported      = false,
    .ue_specific_k_offset_supported = false};
#endif // SRSRAN_HAS_ENTERPRISE

const auto test_cases = to_array<decode_ue_nr_cap_container_params>(
    {decode_ue_nr_cap_container_params{
         .model = "Unknown UE with UL-MIMO and PDSCH VRB-toPRB mapping",
         .message =
             {0xe1, 0xa0, 0x3f, 0xa0, 0x47, 0x48, 0x7a, 0xef, 0x7f, 0xff, 0xaf, 0x01, 0x40, 0x78, 0x2e, 0x02, 0x03,
              0xc1, 0x27, 0xbe, 0x7f, 0xff, 0xff, 0x80, 0x07, 0x03, 0x1b, 0xcf, 0x80, 0x01, 0x40, 0xdc, 0x04, 0x07,
              0xe3, 0x81, 0x95, 0x17, 0xc0, 0x0f, 0x78, 0x9c, 0x21, 0xd8, 0x81, 0x04, 0x3f, 0x28, 0x04, 0x41, 0x6c,
              0xa8, 0xe8, 0x06, 0x24, 0xfa, 0xc4, 0x1e, 0x42, 0x0f, 0x08, 0x14, 0x25, 0xbe, 0x7e, 0x02, 0x7f, 0xf1,
              0xfc, 0x00, 0x1f, 0xfc, 0x7f, 0x00, 0x00, 0xb8, 0x00, 0xe0, 0x00, 0xa0, 0x54, 0x5f, 0x00, 0xbd, 0xe2,
              0x70, 0x87, 0x62, 0x04, 0x10, 0xfc, 0xa0, 0x11, 0x05, 0xb2, 0xa3, 0xa0, 0x18, 0x93, 0xeb, 0x10, 0x79,
              0x08, 0x3c, 0x20, 0x50, 0x96, 0xf9, 0xf8, 0x09, 0xff, 0x87, 0xe0, 0x00, 0x7f, 0xe1, 0xf8, 0x00, 0x02,
              0xe0, 0x03, 0x80, 0x02, 0x81, 0x51, 0x7c, 0x04, 0xf7, 0x89, 0xc2, 0x1d, 0x88, 0x10, 0x43, 0xf2, 0x80,
              0x44, 0x16, 0xca, 0x8e, 0x80, 0x62, 0x4f, 0xac, 0x41, 0xe4, 0x20, 0xf0, 0x81, 0x42, 0x5b, 0xe7, 0xe0,
              0x27, 0xfc, 0x1f, 0x00, 0x01, 0xff, 0x07, 0xc0, 0x00, 0x0b, 0x80, 0x0e, 0x00, 0x0a, 0x05, 0x45, 0xf0,
              0x1b, 0xde, 0x27, 0x08, 0x76, 0x20, 0x41, 0x0f, 0xca, 0x01, 0x10, 0x5b, 0x2a, 0x3a, 0x01, 0x89, 0x3e,
              0xb1, 0x07, 0x90, 0x83, 0xc2, 0x05, 0x09, 0x6f, 0x9f, 0x80, 0x9f, 0xfc, 0x7f, 0x00, 0x07, 0xff, 0x1f,
              0xc0, 0x00, 0x2e, 0x00, 0x38, 0x00, 0x28, 0x15, 0x17, 0xc0, 0x7f, 0x78, 0x9c, 0x21, 0xd8, 0x81, 0x04,
              0x3f, 0x28, 0x04, 0x41, 0x6c, 0xa8, 0xe8, 0x06, 0x24, 0xfa, 0xc4, 0x1e, 0x42, 0x0f, 0x08, 0x14, 0x25,
              0xbe, 0x7e, 0x02, 0x10, 0x00, 0x40, 0x00, 0xb8, 0x00, 0xe0, 0x00, 0xa0, 0x54, 0x5f, 0x04, 0xfd, 0xe2,
              0x70, 0x87, 0x62, 0x04, 0x10, 0xfc, 0xa0, 0x11, 0x05, 0xb2, 0xa3, 0xa0, 0x18, 0x93, 0xeb, 0x10, 0x79,
              0x08, 0x3c, 0x20, 0x50, 0x96, 0xf9, 0xf8, 0x08, 0x40, 0x01, 0x00, 0x02, 0xe0, 0x03, 0x80, 0x02, 0x81,
              0x51, 0x7c, 0x1b, 0xf7, 0x89, 0xc2, 0x1d, 0x88, 0x10, 0x43, 0xf2, 0x80, 0x44, 0x16, 0xca, 0x8e, 0x80,
              0x62, 0x4f, 0xac, 0x41, 0xe4, 0x20, 0xf0, 0x81, 0x42, 0x5b, 0xe7, 0xe0, 0x27, 0xf4, 0x1d, 0x00, 0x01,
              0xfd, 0x07, 0x40, 0x00, 0x0b, 0x80, 0x0e, 0x00, 0x0a, 0x05, 0x45, 0xf0, 0x97, 0xde, 0x27, 0x08, 0x76,
              0x20, 0x41, 0x0f, 0xca, 0x01, 0x10, 0x5b, 0x2a, 0x3a, 0x01, 0x89, 0x3e, 0xb1, 0x07, 0x90, 0x83, 0xc2,
              0x05, 0x09, 0x6f, 0x9f, 0x80, 0x9f, 0xf8, 0x7e, 0x00, 0x07, 0xfe, 0x1f, 0x80, 0x00, 0x2e, 0x00, 0x38,
              0x00, 0x28, 0x15, 0x17, 0xc2, 0x7f, 0x78, 0x9c, 0x21, 0xd8, 0x81, 0x04, 0x3f, 0x28, 0x04, 0x41, 0x6c,
              0xa8, 0xe8, 0x06, 0x24, 0xfa, 0xc4, 0x1e, 0x42, 0x0f, 0x08, 0x14, 0x25, 0xbe, 0x7e, 0x02, 0x10, 0x00,
              0x40, 0x00, 0xb8, 0x00, 0xe0, 0x00, 0xa0, 0x54, 0x5f, 0x0a, 0x3d, 0xe2, 0x70, 0x87, 0x62, 0x04, 0x10,
              0xfc, 0xa0, 0x11, 0x05, 0xb2, 0xa3, 0xa0, 0x18, 0x93, 0xeb, 0x10, 0x79, 0x08, 0x3c, 0x20, 0x50, 0x96,
              0xf9, 0xf8, 0x05, 0xdd, 0xc7, 0x7c, 0x00, 0x77, 0x71, 0xdf, 0x00, 0x02, 0xe8, 0x03, 0x80, 0x02, 0x80,
              0x0d, 0x94, 0x00, 0x01, 0x40, 0x00, 0x01, 0x51, 0x7c, 0x46, 0xf7, 0x89, 0xc2, 0x1d, 0x88, 0x10, 0x43,
              0xf2, 0x80, 0x44, 0x16, 0xca, 0x8e, 0x80, 0x62, 0x4f, 0xac, 0x41, 0xe4, 0x20, 0xf0, 0x81, 0x42, 0x5b,
              0xe7, 0xe0, 0x21, 0x00, 0x04, 0x00, 0x0b, 0x80, 0x0e, 0x00, 0x0a, 0x05, 0x45, 0xf1, 0x33, 0xde, 0x27,
              0x08, 0x76, 0x20, 0x41, 0x0f, 0xca, 0x01, 0x10, 0x5b, 0x2a, 0x3a, 0x01, 0x89, 0x3e, 0xb1, 0x07, 0x90,
              0x83, 0xc2, 0x05, 0x09, 0x6f, 0x9f, 0x80, 0x44, 0x00, 0x10, 0x00, 0x2e, 0x80, 0x38, 0x00, 0x28, 0x00,
              0xd9, 0x40, 0x00, 0x14, 0x00, 0x00, 0x15, 0x17, 0xc4, 0xdf, 0x78, 0x9c, 0x21, 0xd8, 0x81, 0x04, 0x3f,
              0x28, 0x04, 0x41, 0x6c, 0xa8, 0xe8, 0x06, 0x24, 0xfa, 0xc4, 0x1e, 0x42, 0x0f, 0x08, 0x14, 0x25, 0xbe,
              0x7e, 0x01, 0x77, 0x71, 0xdf, 0x00, 0x1d, 0xdc, 0x77, 0xc0, 0x00, 0xba, 0x00, 0xe0, 0x00, 0xa0, 0x03,
              0x65, 0x00, 0x00, 0x50, 0x00, 0x00, 0x01, 0xac, 0x1c, 0x4d, 0x08, 0x00, 0x00, 0x62, 0x27, 0x54, 0x0e,
              0x26, 0x84, 0x10, 0x01, 0x31, 0x13, 0xaa, 0x0f, 0x13, 0x40, 0x03, 0x09, 0xa0, 0x00, 0x23, 0x11, 0x3a,
              0x00, 0x20, 0x26, 0x8b, 0xa0, 0x01, 0x18, 0x0e, 0x04, 0x6d, 0x92, 0x7c, 0x08, 0x13, 0xb6, 0x49, 0xf0,
              0x21, 0x46, 0x9d, 0xb2, 0x4f, 0x80, 0x00, 0x38, 0x18, 0xc6, 0x3f, 0xff, 0xf8, 0x00, 0x02, 0xa0, 0x2a,
              0x00, 0x30, 0x1c, 0x04, 0x06, 0x03, 0x10, 0x5c, 0x06, 0x00, 0x07, 0x00, 0x06, 0x03, 0xe0, 0x28, 0x82,
              0x00, 0x10, 0x00, 0x00, 0x10, 0x40, 0x02, 0x00, 0x00, 0x22, 0x08, 0x00, 0x40, 0x10, 0x00, 0x41, 0x00,
              0x08, 0x02, 0x00, 0x88, 0x20, 0x00, 0x00, 0x04, 0x10, 0x00, 0x00, 0x20, 0x0b, 0x07, 0x6f, 0x2a, 0x68,
              0x0a, 0x08, 0x00, 0x00, 0x4b, 0x2c, 0xa8, 0x20, 0x00, 0x03, 0x2c, 0xb2, 0xa0, 0x80, 0x20, 0x10, 0x05,
              0x2c, 0xb2, 0x80, 0x80, 0x20, 0x10, 0x07, 0x2c, 0xb2, 0x80, 0x80, 0x20, 0x18, 0x05, 0x2c, 0xb2, 0x80,
              0x80, 0x20, 0x18, 0x07, 0x2c, 0xb2, 0x80, 0x1a, 0x83, 0xd5, 0xd2, 0xaa, 0xaa, 0x0f, 0x17, 0x4a, 0xa2,
              0x81, 0x82, 0x60, 0x0b, 0xe0, 0xf0, 0x78, 0x2c, 0x1e, 0x0b, 0x00, 0x00, 0x20, 0x03, 0x80, 0x10, 0x03,
              0x00, 0x40, 0x06, 0x00, 0xc0, 0x14, 0x02, 0x00, 0x20, 0x03, 0x80, 0x10, 0x07, 0x00, 0x40, 0x12, 0x00,
              0xc0, 0x2c, 0x02, 0x00, 0x60, 0x83, 0x80, 0x50, 0x03, 0x00, 0xa0, 0x06, 0x01, 0x80, 0x14, 0x03, 0x00,
              0x20, 0x70, 0x0a, 0x00, 0x20, 0x18, 0x00, 0x40, 0x28, 0x00, 0x80, 0x60, 0x00, 0x06, 0x02},
         .expected_capabilities = {.pdsch_qam256_supported     = true,
                                   .pdsch_qam64lowse_supported = true,
                                   .pusch_qam64lowse_supported = false,
                                   .bands =
                                       {
#ifdef SRSRAN_HAS_ENTERPRISE
                                           {nr_band::n78, supported_band_2x2_non_coherent},
#else  // SRSRAN_HAS_ENTERPRISE
                                           {nr_band::n78, supported_band_no_ul_mimo},
#endif // SRSRAN_HAS_ENTERPRISE
                                           {nr_band::n71, supported_band_no_ul_mimo},
                                           {nr_band::n77, supported_band_no_ul_mimo},
                                           {nr_band::n38, supported_band_no_ul_mimo},
                                           {nr_band::n41, supported_band_no_ul_mimo},
                                           {nr_band::n28, supported_band_no_ul_mimo},
                                           {nr_band::n8, supported_band_no_ul_mimo},
                                           {nr_band::n20, supported_band_no_ul_mimo},
                                           {nr_band::n7, supported_band_no_ul_mimo},
                                           {nr_band::n5, supported_band_no_ul_mimo},
                                           {nr_band::n3, supported_band_no_ul_mimo},
                                           {nr_band::n40, supported_band_no_ul_mimo},
                                           {nr_band::n1, supported_band_no_ul_mimo}},
                                   .long_drx_cycle_supported                = false,
                                   .short_drx_cycle_supported               = false,
                                   .pdsch_interleaving_vrb_to_prb_supported = true,
                                   .ntn_supported                           = false,
                                   .disabled_dl_harq_feedback_supported     = false,
                                   .ul_harq_mode_b_supported                = false}},
     {.model = "Motorola Edge 30 Pro",
      .message =
          {0xe1, 0xa2, 0x53, 0x80, 0x57, 0x4f, 0x7a, 0x03, 0x56, 0x08, 0x03, 0x04, 0x40, 0x0b, 0x04, 0x00, 0x40, 0x60,
           0x24, 0xc5, 0xc0, 0x06, 0x70, 0xf4, 0x1c, 0x01, 0x89, 0x06, 0x80, 0x4c, 0x02, 0x03, 0x11, 0x80, 0x82, 0x83,
           0x61, 0x3e, 0xb0, 0x46, 0x10, 0xd0, 0x40, 0x83, 0xa4, 0x0a, 0x0a, 0x2d, 0x95, 0x45, 0x42, 0x43, 0x9f, 0x40,
           0xcf, 0xb0, 0x27, 0xc6, 0x39, 0xf3, 0x0c, 0x79, 0x42, 0xc0, 0xe0, 0x70, 0xf0, 0x4e, 0x00, 0x3b, 0xe0, 0x03,
           0x80, 0x0e, 0xf8, 0x01, 0x50, 0x6c, 0x4d, 0xd6, 0x08, 0xc2, 0x1a, 0x08, 0x10, 0x74, 0x81, 0x41, 0x45, 0xb2,
           0xa8, 0xa8, 0x48, 0x73, 0xe8, 0x19, 0xf6, 0x04, 0xf8, 0xc7, 0x3e, 0x61, 0x8f, 0x28, 0x58, 0x1c, 0x0e, 0x1e,
           0x05, 0xc0, 0x07, 0x7c, 0x00, 0x70, 0x01, 0xdf, 0x00, 0x03, 0x08, 0x06, 0xca, 0x00, 0x00, 0xa0, 0x00, 0x00,
           0x28, 0x36, 0x12, 0xeb, 0x04, 0x61, 0x0d, 0x04, 0x08, 0x3a, 0x40, 0xa0, 0xa2, 0xd9, 0x54, 0x54, 0x24, 0x39,
           0xf4, 0x0c, 0xfb, 0x02, 0x7c, 0x63, 0x9f, 0x30, 0xc7, 0x94, 0x2c, 0x0e, 0x07, 0x0f, 0x04, 0xe0, 0x03, 0xb0,
           0x00, 0x38, 0x00, 0xec, 0x00, 0x05, 0x07, 0xc1, 0xbd, 0x60, 0x8c, 0x21, 0xa0, 0x81, 0x07, 0x88, 0x14, 0x12,
           0x5b, 0x2a, 0x8a, 0x82, 0x87, 0x3e, 0x81, 0x9f, 0x18, 0xe7, 0xcc, 0x31, 0xe5, 0x0b, 0x03, 0x81, 0xc3, 0xc0,
           0x9f, 0xd0, 0x00, 0x00, 0x07, 0xf4, 0x00, 0x00, 0x00, 0xa0, 0xf8, 0x0f, 0xac, 0x11, 0x84, 0x34, 0x10, 0x20,
           0xf1, 0x02, 0x82, 0x4b, 0x65, 0x51, 0x50, 0x50, 0xe7, 0xd0, 0x33, 0xe3, 0x1c, 0xf9, 0x86, 0x3c, 0xa1, 0x60,
           0x70, 0x38, 0x78, 0x13, 0xf8, 0x00, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x14, 0x1f, 0x01, 0xb5, 0x82, 0x30,
           0x86, 0x82, 0x04, 0x1e, 0x20, 0x50, 0x49, 0x6c, 0xaa, 0x2a, 0x0a, 0x1c, 0xfa, 0x06, 0x7c, 0x63, 0x9f, 0x30,
           0xc7, 0x94, 0x2c, 0x0e, 0x07, 0x0f, 0x02, 0x7f, 0xf0, 0x00, 0x00, 0x1f, 0xfc, 0x00, 0x00, 0x02, 0x83, 0xe0,
           0x16, 0xb0, 0x46, 0x10, 0xd0, 0x40, 0x83, 0xc4, 0x0a, 0x09, 0x2d, 0x95, 0x45, 0x41, 0x43, 0x9f, 0x40, 0xcf,
           0x8c, 0x73, 0xe6, 0x18, 0xf2, 0x85, 0x81, 0xc0, 0xe1, 0xe0, 0x4f, 0xfe, 0x00, 0x00, 0x03, 0xff, 0x80, 0x00,
           0x00, 0x50, 0x7c, 0x00, 0xd6, 0x08, 0xc2, 0x1a, 0x08, 0x10, 0x78, 0x81, 0x41, 0x25, 0xb2, 0xa8, 0xa8, 0x28,
           0x73, 0xe8, 0x19, 0xf1, 0x8e, 0x7c, 0xc3, 0x1e, 0x50, 0xb0, 0x38, 0x1c, 0x3c, 0x09, 0xff, 0xc0, 0x00, 0x00,
           0x7f, 0xf0, 0x00, 0x00, 0x0a, 0x0f, 0x82, 0x7a, 0xc1, 0x18, 0x43, 0x41, 0x02, 0x0f, 0x10, 0x28, 0x24, 0xb6,
           0x55, 0x15, 0x05, 0x0e, 0x7d, 0x03, 0x3e, 0x31, 0xcf, 0x98, 0x63, 0xca, 0x16, 0x07, 0x03, 0x87, 0x81, 0x3f,
           0x80, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0xf8, 0xc3, 0x82, 0x70, 0x38, 0x9a, 0x00, 0x00, 0x00, 0x11,
           0x07, 0x84, 0xe0, 0x01, 0x84, 0xd0, 0x00, 0x08, 0x23, 0x0e, 0x09, 0x40, 0xe2, 0x68, 0x00, 0x00, 0x20, 0xe2,
           0x0f, 0x09, 0x40, 0x03, 0x09, 0xa0, 0x00, 0x30, 0xeb, 0x0e, 0x06, 0xc0, 0xe2, 0x68, 0x00, 0x00, 0x40, 0x80,
           0x75, 0x07, 0x83, 0x60, 0x01, 0x84, 0xd0, 0x00, 0x28, 0x48, 0x3a, 0xc3, 0x80, 0x70, 0x38, 0x9a, 0x00, 0x00,
           0x18, 0x20, 0x1d, 0x41, 0xe0, 0x38, 0x00, 0x61, 0x34, 0x00, 0x0e, 0x12, 0x0e, 0xb0, 0xe0, 0x18, 0x0e, 0x26,
           0x80, 0x00, 0x08, 0x08, 0x07, 0x50, 0x78, 0x0c, 0x00, 0x18, 0x4d, 0x00, 0x04, 0x84, 0x83, 0xac, 0x38, 0x02,
           0x03, 0x89, 0xa0, 0x00, 0x02, 0x82, 0x01, 0xd4, 0x1e, 0x01, 0x00, 0x06, 0x13, 0x40, 0x01, 0x61, 0x20, 0xeb,
           0x0e, 0x00, 0x00, 0xe2, 0x68, 0x00, 0x00, 0x80, 0x80, 0xba, 0x83, 0xc0, 0x00, 0x00, 0xc2, 0x68, 0x00, 0x24,
           0x24, 0x2e, 0xa1, 0x60, 0x00, 0x0c, 0x01, 0x01, 0xc1, 0xb0, 0x00, 0x01, 0x81, 0x00, 0x54, 0x2c, 0x00, 0x01,
           0xc0, 0x20, 0x00, 0xc0, 0xd8, 0x00, 0x34, 0x20, 0x0a, 0x85, 0xc0, 0x00, 0x00, 0xc0, 0x10, 0x18, 0x1b, 0x00,
           0x07, 0x04, 0x01, 0x50, 0x70, 0x04, 0x07, 0x06, 0xc0, 0x00, 0x07, 0x84, 0x01, 0x50, 0x78, 0x04, 0x00, 0x18,
           0x1b, 0x00, 0x08, 0x04, 0x01, 0x50, 0x70, 0x00, 0x07, 0x06, 0xc0, 0x00, 0x07, 0x84, 0x01, 0x50, 0x78, 0x00,
           0x00, 0x18, 0x1b, 0x00, 0x08, 0x04, 0x01, 0x00, 0x38, 0x26, 0x00, 0x00, 0x45, 0x41, 0xc0, 0x10, 0x1c, 0x07,
           0x00, 0x00, 0x24, 0x10, 0x05, 0x41, 0xe0, 0x10, 0x00, 0x60, 0x1c, 0x00, 0x26, 0x10, 0x05, 0x41, 0xc0, 0x00,
           0x1c, 0x07, 0x00, 0x00, 0x28, 0x10, 0x05, 0x41, 0xe0, 0x00, 0x00, 0x60, 0x1c, 0x00, 0x2a, 0x10, 0x05, 0x42,
           0xc0, 0x00, 0x18, 0x02, 0x03, 0x80, 0xc0, 0x00, 0x05, 0x82, 0x01, 0xd4, 0x2c, 0x00, 0x01, 0xc0, 0x20, 0x00,
           0xc0, 0x30, 0x00, 0x5c, 0x20, 0x1d, 0x42, 0xe0, 0x00, 0x00, 0x60, 0x08, 0x0c, 0x03, 0x00, 0x06, 0x02, 0x01,
           0xd4, 0x1c, 0x00, 0x01, 0xc0, 0x20, 0x00, 0x03, 0x21, 0x00, 0xea, 0x0f, 0x00, 0x00, 0x03, 0x00, 0x40, 0x01,
           0xa0, 0x80, 0x70, 0x94, 0x80, 0xb4, 0x87, 0xe1, 0x4e, 0x85, 0xb1, 0xcf, 0x87, 0x0a, 0x74, 0xed, 0x8e, 0x7c,
           0x38, 0x53, 0xa1, 0x6c, 0x73, 0xe1, 0xc2, 0x9d, 0x3b, 0x63, 0x9f, 0x0e, 0x14, 0xe8, 0x5b, 0x1c, 0xf8, 0x70,
           0xa7, 0x4e, 0xd8, 0xe7, 0xc3, 0x85, 0x3a, 0x16, 0xc7, 0x3e, 0x1c, 0x29, 0xd3, 0xb6, 0x39, 0xf0, 0xe1, 0x4e,
           0x85, 0xb1, 0xcf, 0x87, 0x0a, 0x74, 0xed, 0x8e, 0x7c, 0x38, 0x53, 0xa1, 0x6c, 0x73, 0xe1, 0xc2, 0x9d, 0x3b,
           0x63, 0x9f, 0x0e, 0x14, 0xe8, 0x5b, 0x1c, 0xf8, 0x70, 0xa7, 0x4e, 0xd8, 0xe7, 0xc3, 0x89, 0x3a, 0x74, 0xed,
           0x8e, 0x7c, 0x38, 0x93, 0xa7, 0x4e, 0xd8, 0xe7, 0xc3, 0x89, 0x3a, 0x74, 0xed, 0x8e, 0x7c, 0x38, 0x53, 0xa7,
           0x6c, 0x73, 0xe1, 0xc2, 0x9d, 0x3b, 0x63, 0x9f, 0x0e, 0x14, 0xe9, 0xdb, 0x1c, 0xf8, 0x70, 0xa7, 0x4e, 0xd8,
           0xe7, 0xc3, 0x81, 0x3b, 0x63, 0x9f, 0x0e, 0x14, 0xe9, 0xdb, 0x1c, 0xf8, 0x70, 0xa7, 0x4e, 0xd8, 0xe7, 0xc3,
           0x85, 0x3a, 0x76, 0xc7, 0x3e, 0x1c, 0x29, 0xd3, 0xb6, 0x39, 0xf0, 0xe2, 0x4e, 0x9d, 0x3b, 0x63, 0x9f, 0x0e,
           0x24, 0xe9, 0xd3, 0xb6, 0x39, 0xf0, 0xe2, 0x4e, 0x9d, 0x3b, 0x63, 0x9f, 0x0e, 0x14, 0xe9, 0xdb, 0x1c, 0xf8,
           0x70, 0xa7, 0x4e, 0xd8, 0xe7, 0xc3, 0x15, 0x8f, 0x88, 0x42, 0x10, 0xc4, 0x31, 0x0c, 0x43, 0x10, 0xc4, 0x21,
           0x08, 0x42, 0x10, 0x84, 0x21, 0x08, 0x42, 0x10, 0x84, 0x20, 0xf4, 0x12, 0xa0, 0x3e, 0x00, 0x30, 0x00, 0x70,
           0x00, 0x00, 0x10, 0x14, 0x01, 0x80, 0xc0, 0x25, 0x00, 0x60, 0x00, 0x60, 0x3e, 0x05, 0x00, 0x20, 0x00, 0x00,
           0x00, 0x10, 0x00, 0x00, 0x20, 0x08, 0x00, 0x00, 0x20, 0x04, 0x00, 0x00, 0x18, 0x02, 0x00, 0x00, 0x10, 0x01,
           0x00, 0x00, 0x0a, 0x00, 0x80, 0x00, 0x06, 0x00, 0x40, 0x00, 0x03, 0x80, 0x20, 0x00, 0x02, 0x00, 0x10, 0x00,
           0x01, 0x20, 0x08, 0x00, 0x00, 0xa0, 0x29, 0x94, 0xb7, 0x95, 0x35, 0x93, 0x35, 0x82, 0x95, 0x81, 0x95, 0x83,
           0x35, 0x82, 0xb5, 0x81, 0x35, 0x81, 0x15, 0x81, 0xb5, 0x80, 0xb4, 0x07, 0x04, 0x00, 0x00, 0x25, 0x94, 0x90,
           0x10, 0x00, 0x01, 0x96, 0x52, 0x40, 0x40, 0x00, 0x0a, 0x59, 0x49, 0x01, 0x00, 0x00, 0x39, 0x65, 0x24, 0x04,
           0x00, 0x01, 0x25, 0x94, 0x90, 0x10, 0x00, 0x05, 0x96, 0x52, 0x40, 0x40, 0x00, 0x1a, 0x59, 0x49, 0x01, 0x00,
           0x00, 0x79, 0x65, 0x24, 0x01, 0xf4, 0xaa, 0x2a, 0x94, 0xc5, 0x52, 0x68, 0xaa, 0x0b, 0x15, 0x40, 0xe2, 0xa8,
           0x34, 0x55, 0x02, 0x8a, 0xa0, 0x31, 0x41, 0xd0, 0xae, 0x02, 0xa8, 0x14, 0x0a, 0x07, 0x03, 0x81, 0xc0, 0xe0,
           0x70, 0x38, 0x1c, 0x0e, 0x00, 0x0e, 0x84, 0x21, 0x08, 0x42, 0x10, 0x01, 0x22, 0x01, 0xc4, 0x00, 0x00, 0x02,
           0x01, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x08, 0x04, 0x00, 0x00, 0x02, 0x01,
           0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x08, 0x00, 0x34, 0x10, 0x10, 0x02, 0x00,
           0x00, 0x40, 0x10, 0x01, 0x08, 0x08, 0x01, 0x00, 0x40, 0x20, 0x08, 0x00, 0x04, 0x04, 0x01, 0x80, 0x00, 0x10,
           0x04, 0x00, 0x42, 0x02, 0x00, 0xc0, 0x18, 0x08, 0x02, 0x00, 0x01, 0x01, 0x00, 0x80, 0x00, 0x04, 0x01, 0x00,
           0x10, 0x80, 0x80, 0x40, 0x08, 0x02, 0x00, 0x80, 0x00, 0x40, 0x40, 0x28, 0x00, 0x01, 0x00, 0x40, 0x04, 0x20,
           0x20, 0x14, 0x02, 0x80, 0x80, 0x20, 0x00, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x40, 0x10, 0x01, 0x08, 0x08, 0x06,
           0x00, 0xc0, 0x20, 0x08, 0x00, 0x04, 0x04, 0x03, 0x80, 0x00, 0x10, 0x04, 0x00, 0x42, 0x02, 0x01, 0xc0, 0x20,
           0x08, 0x02, 0x00, 0x02, 0x05, 0x01, 0x00, 0x02, 0x02, 0x80, 0x04, 0x04, 0x00, 0x00, 0x50, 0x0e, 0x00, 0x20,
           0x28, 0x00, 0x40, 0x40, 0x00, 0x05, 0x01, 0x20, 0x1e, 0x01, 0x40, 0x2c, 0x02, 0x00, 0x41, 0x02, 0x80, 0x80,
           0x01, 0x01, 0x40, 0x02, 0x02, 0x00, 0x00, 0x28, 0x07, 0x00, 0x90, 0x14, 0x01, 0x60, 0x20, 0x03, 0x82, 0x80,
           0x90, 0x01, 0x00, 0xa0, 0x02, 0x01, 0x00, 0x00, 0x81, 0x40, 0x40, 0x07, 0x80, 0xa0, 0x0b, 0x01, 0x00, 0x1c,
           0x14, 0x03, 0x80, 0x08, 0x0a, 0x00, 0x10, 0x10, 0x00, 0x01, 0x40, 0x48, 0x00, 0x80, 0x50, 0x01, 0x00, 0x80,
           0x00, 0x20, 0x20, 0x1c, 0x00, 0x00, 0x80, 0x40, 0x08, 0x10, 0x10, 0x0e, 0x01, 0x00, 0x40, 0x20, 0x00, 0x00,
           0x08, 0x05, 0x00, 0xa1, 0x01, 0x00, 0xe0, 0x00, 0x04, 0x02, 0x80, 0x50, 0x80, 0x80, 0x70, 0x08, 0x02, 0x01,
           0x40, 0x00, 0x40, 0x40, 0x30, 0x00, 0x01, 0x00, 0xa0, 0x14, 0x20, 0x20, 0x18, 0x03, 0x00, 0x80, 0x50, 0x00,
           0x20, 0x10, 0x14, 0x00, 0x00, 0x40, 0x50, 0x00, 0x01, 0x01, 0x40, 0x14, 0x40, 0x20, 0x28, 0x00, 0x00, 0x80,
           0xa0, 0x0a, 0x02, 0x02, 0x80, 0x00, 0x80, 0x40, 0x50, 0x05, 0x01, 0x01, 0x40, 0x00, 0x04, 0x05, 0x00, 0x00,
           0x81, 0x80, 0x60, 0x01, 0x00, 0xe0, 0x00, 0x0c, 0x05, 0x80, 0x88, 0x07, 0x00, 0x81, 0x03, 0x00, 0xc0, 0x1a,
           0x01, 0xc0, 0x20, 0x18, 0x0b, 0x00, 0x10, 0x0e, 0x00, 0x00, 0xb1, 0x70, 0x14, 0x06, 0x01, 0x4a, 0x20, 0x20,
           0x06, 0x73, 0x00

          },
      .expected_capabilities = {.pdsch_qam256_supported                  = true,
                                .pdsch_qam64lowse_supported              = false,
                                .pusch_qam64lowse_supported              = false,
                                .bands                                   = {{nr_band::n3, supported_band_no_ul_mimo},
                                                                            {nr_band::n20, supported_band_no_ul_mimo},
                                                                            {nr_band::n7, supported_band_no_ul_mimo},
                                                                            {nr_band::n8, supported_band_no_ul_mimo},
                                                                            {nr_band::n28, supported_band_no_ul_mimo},
                                                                            {nr_band::n38, supported_band_no_ul_mimo},
                                                                            {nr_band::n78, supported_band_no_ul_mimo},
                                                                            {nr_band::n1, supported_band_no_ul_mimo},
                                                                            {nr_band::n40, supported_band_no_ul_mimo}},
                                .long_drx_cycle_supported                = true,
                                .short_drx_cycle_supported               = true,
                                .pdsch_interleaving_vrb_to_prb_supported = false,
                                .ntn_supported                           = false,
                                .disabled_dl_harq_feedback_supported     = false,
                                .ul_harq_mode_b_supported                = false}}});

INSTANTIATE_TEST_SUITE_P(parametrized_test_decode_ue_nr_cap_container_tester,
                         decode_ue_nr_cap_container_tester,
                         ::testing::ValuesIn(test_cases));
